package com.yidu.logisticssystem.service.impl;

import com.yidu.logisticssystem.entity.LogisticsModxpost;
import com.yidu.logisticssystem.dao.LogisticsModxpostDao;
import com.yidu.logisticssystem.service.LogisticsModxpostService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 模块职位关联表(LogisticsModxpost)表服务实现类
 *
 * @author makejava
 * @since 2021-03-12 15:07:53
 */
@Service("logisticsModxpostService")
public class LogisticsModxpostServiceImpl implements LogisticsModxpostService {
    @Resource
    private LogisticsModxpostDao logisticsModxpostDao;

    /**
     * 通过ID查询单条数据
     *
     * @param modxpostId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsModxpost queryById(Integer modxpostId) {
        return this.logisticsModxpostDao.queryById(modxpostId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsModxpost> queryAllByLimit(int offset, int limit) {
        return this.logisticsModxpostDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsModxpost 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsModxpost insert(LogisticsModxpost logisticsModxpost) {
        this.logisticsModxpostDao.insert(logisticsModxpost);
        return logisticsModxpost;
    }

    /**
     * 修改数据
     *
     * @param logisticsModxpost 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsModxpost update(LogisticsModxpost logisticsModxpost) {
        this.logisticsModxpostDao.update(logisticsModxpost);
        return this.queryById(logisticsModxpost.getModxpostId());
    }

    /**
     * 通过主键删除数据
     *
     * @param modxpostId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer modxpostId) {
        return this.logisticsModxpostDao.deleteById(modxpostId) > 0;
    }

    @Override
    public List<LogisticsModxpost> queryPostId(Integer modDownid) {
        return this.logisticsModxpostDao.queryPostId(modDownid);
    }

    @Override
    public LogisticsModxpost queryByIdint(LogisticsModxpost lmp) {
        return this.logisticsModxpostDao.queryByIdint(lmp);
    }

    @Override
    public int deleteBymodId(Integer modId) {
        return logisticsModxpostDao.deleteBymodId(modId);
    }

    /**
     * 通过角色id删除角色权限
     * @param postId 主键
     * @return 影响行数
     */
    @Override
    public boolean deleteByPostId(Integer postId) {
        return this.logisticsModxpostDao.deleteByPostId(postId) > 0;
    }
}
